package com.itheima;

import com.itheima.utils.IdWorker;
import com.itheima.utils.TokenDecode;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.domain.EntityScan;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.context.annotation.Bean;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import tk.mybatis.spring.annotation.MapperScan;

/**
 * Created by lenovo on 2020/7/1.
 */
@EnableEurekaClient
@SpringBootApplication(scanBasePackages = "com.itheima")
@EntityScan("com.itheima.pojo")
@MapperScan(basePackages = "com.itheima.dao")
@ServletComponentScan(basePackages = "com.itheima.filter")  //servlet核心组件扫描组件,可以使用webServlet,webFilter,webListener注解
public class AdminApplication {

    public static void main(String[] args) {
        System.setProperty("es.set.netty.runtime.available.processors", "false");
        SpringApplication.run(AdminApplication.class);
    }

    @Bean
    public IdWorker idWorker() {
        return new IdWorker(1, 1);
    }

    @Bean
    public BCryptPasswordEncoder bCryptPasswordEncoder(){
        return new BCryptPasswordEncoder();
    }

    @Bean
    public TokenDecode tokenDecode(){
        return new TokenDecode();
    }
}
